class MyStack {
    queue<int> first;
    public:

    MyStack() {

    }
    
    void push(int x) {
        int size = first.size();
        first.push(x);
        for(int i=0;i<size;i++){
            first.push(first.front());
            first.pop();
        }
    }
    
    int pop() {
        int fin=first.front();
        first.pop();
        return fin;
    }
    
    int top() {
        return first.front();
    }
    
    bool empty() {
        return first.empty();
    }
};

/**
 * Your MyStack object will be instantiated and called as such:
 * MyStack* obj = new MyStack();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->top();
 * bool param_4 = obj->empty();
 */